lvm2: install: fix "Argument list too long" error when copying symlinks
authorPetr Štetiar <[email protected]>
Wed, 21 May 2025 18:48:30 +0000 (18:48 +0000)
committerJosef Schlehofer <[email protected]>
Tue, 21 Oct 2025 23:02:35 +0000 (01:02 +0200)
commit1991fde201138c5e4560c42899c986479f6aba01
tree7413bca4b396837a2c1b3c49a37a5c397d12be9e
parent9f66360e54a489350ebbc178f634911dc4d30866
lvm2: install: fix "Argument list too long" error when copying symlinks

It was reported that in some build environments the install step fails
with following:

 find /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/ipkg-install/usr/sbin/ -type l -exec cp -fpR -a {} /home/.../buildsystem/build_dir/target-aarch64-unknown-linux-gnu_musl/lvm2-normal/LVM2.2.03.22/.pkgdir/lvm2/sbin/ \;
 make[6]: /bin/sh: Argument list too long

This is likely happening once the number of symlinks exceeds the shell's
maximum argument limit.

So lets fix it by switching to more reliable xargs based solution:

 print0/xargs -0 to handle filenames with special characters
 xargs -r to skip execution if no files are found
 cp -t to specify the target directory once instead of for each file

Fixes: #26552
Signed-off-by: Petr Štetiar <[email protected]>
(cherry picked from commit 073b460cb199d096e71f48279efe4e7b4fd64e57)
utils/lvm2/Makefile